< previous page page_346 next page >

Page 346
Listing 9.17. continued
    MsgBox strMsg, vbInformation, "AttachTable"
    '
    db.Close
    ws.Close
    Set td = Nothing
    Set db = Nothing
    Set ws = Nothing
    '
End Sub
The code in Listing 9.17 calls the routine that creates your test database and then opens the created database and creates a new table definition. This time, instead of creating field definitions to append to the new table definition, you create an attachment to another external database. Attachments always have two parts: the Connect string and the SourceTableName.
The Connect string contains all information needed to connect to the external database. For desktop (ISAM-type) databases, you need to supply the driver name (dBASE III, Paradox 3.x, and so on) and the device/path where the data file is located. For back-end database servers, you might need to supply additional parameters.
The SourceTableName contains the name of the data table you want to attach to the Microsoft Jet database. For desktop databases, this is the database filename in the device location (NAMES.DBF, CUSTOMERS.DBF, and so on). For back-end database servers, this is the data table name that already exists in the server database.
Save and run the project. When you click the Attach Table button, you see a few message dialogs flash by. The final dialog lists all the tables in the database (see Figure 9.16).
0346-01.jpg
Figure 9.16.
Viewing the attached
tables dialog.
Notice that the FoxProAttachment table now appears. You can now manipulate this table like any native Microsoft Jet data table object.

 
< previous page page_346 next page >

If you like this book, buy it!